package com.ecoolex.chinadutyfree.retailer.core;

import com.ecoolex.framework.cg.mybatis.MyBatisCodeGenerator;
import com.ecoolex.framework.cg.mybatis.core.ClassPluginInterface;
import com.ecoolex.framework.cg.mybatis.pojo.KeyValue;
import com.ecoolex.framework.cg.mybatis.support.DaoClassGenerate;
import com.ecoolex.framework.cg.mybatis.support.ManagerClassGenerate;

public class ChinadutyfreeRetailerMyBatisCodegen {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		// 配置项目路径
		MyBatisCodeGenerator generator = MyBatisCodeGenerator.create("src/main/java", "com.ecoolex.chinadutyfree.retailer.core",
				KeyValue.create(ClassPluginInterface.TARGET_ENTITY, "com.ecoolex.chinadutyfree.retailer.entity"),
				KeyValue.create(ClassPluginInterface.OVERRIDE, "false"));
		// 添加转移目录
		generator.addTransferPackage("com.ecoolex.chinadutyfree.retailer.entity", "../chinadutyfree-retailer-entity/");
		// 配置数据库
		generator.setJdbcConnection("com.mysql.jdbc.Driver",
				"jdbc:mysql://47.101.161.12:3306/template-chinadutyfree-retailer?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull",
				"root", "Kcxx1245!", KeyValue.create("nullCatalogMeansCurrent", "true"));
		// 配置插件
		// 扩展dao插件
		generator.addPlugin(DaoClassGenerate.class);
		// 业务逻辑插件
		generator.addPlugin(ManagerClassGenerate.class);

		// 配置表
		// 自动增长主键模版
		// generator.createDefaultTable("member", "Member", "id");
		// 非自增长主键，自设主键模版
		// generator.createDefaultTable("user_info", "UserInfo");
		// 视图
//		generator.createView("user", "User");
		// 配送方式和邮费模板
		generator.createDefaultTable("delivery_manner", "DeliveryManner", "DeliveryMannerId");
		generator.createDefaultTable("freight_template", "FreightTemplate", "FreightTemplateId");
		generator.createDefaultTable("freight_template_charging", "FreightTemplateCharging", "ChargingId");
		generator.createDefaultTable("freight_template_charging_region", "FreightTemplateChargingRegion", "Id");
		// 品牌,分类,售后模板
		generator.createDefaultTable("goods_brand", "GoodsBrand", "BrandId");
		generator.createDefaultTable("goods_category", "GoodsCategory", "CategoryId");
		generator.createDefaultTable("goods_category_marketing", "GoodsCategoryMarketing","Id");
		generator.createDefaultTable("goods_after_service", "GoodsAfterService", "AfterServiceId");
		// 商品库
		generator.createDefaultTable("goods", "Goods", "GoodsId");
		generator.createDefaultTable("goods_barcode", "GoodsBarcode", "Id");
		generator.createDefaultTable("goods_product", "GoodsProduct", "ProductId");
		generator.createDefaultTable("goods_shopwindow", "GoodsShopwindow", "Id");
		generator.createDefaultTable("goods_spec_group", "GoodsSpecGroup", "SpecGroupId");
		generator.createDefaultTable("goods_spec", "GoodsSpec", "SpecId");
		// 直邮商品
		generator.createDefaultTable("direct_mail_goods", "DirectMailGoods", "DirectMailGoodsId");
		generator.createDefaultTable("direct_mail_goods_delivery_manner", "DirectMailGoodsDeliveryManner", "Id");
		generator.createDefaultTable("direct_mail_goods_product", "DirectMailGoodsProduct", "DirectMailProductId");
		generator.createDefaultTable("direct_mail_goods_dummy", "DirectMailGoodsDummy");
		generator.createDefaultTable("direct_mail_goods_marketing", "DirectMailGoodsMarketing", "Id");
		generator.createDefaultTable("direct_mail_goods_audit", "DirectMailGoodsAudit", "AuditId");
		generator.createDefaultTable("direct_mail_goods_product_buy_limit", "DirectMailGoodsProductBuyLimit", "Id");
		// 素材
		generator.createDefaultTable("material", "Material", "Id");
		// 直邮购物车
		generator.createDefaultTable("direct_mail_goods_shopping_cart", "DirectMailGoodsShoppingCart", "CartId");
		// 直邮商品订单
		generator.createDefaultTable("direct_mail_goods_order", "DirectMailGoodsOrder", "OrderId");
		generator.createDefaultTable("direct_mail_goods_order_no", "DirectMailGoodsOrderNo", "OrderNo");
		generator.createDefaultTable("direct_mail_goods_order_detail", "DirectMailGoodsOrderDetail", "DetailId");
		generator.createDefaultTable("direct_mail_goods_order_sender", "DirectMailGoodsOrderSender");
		generator.createDefaultTable("direct_mail_goods_order_receiver", "DirectMailGoodsOrderReceiver");
		generator.createDefaultTable("direct_mail_goods_order_identity", "DirectMailGoodsOrderIdentity");
		generator.createDefaultTable("direct_mail_goods_order_shipped_record", "DirectMailGoodsOrderShippedRecord", "ShippedRecordId");
		generator.createDefaultTable("direct_mail_goods_order_after_sales", "DirectMailGoodsOrderAfterSales", "AfterSalesId");
		generator.createDefaultTable("direct_mail_goods_order_after_sales_record", "DirectMailGoodsOrderAfterSalesRecord", "RecordId");
		generator.createDefaultTable("direct_mail_goods_order_coupon", "DirectMailGoodsOrderCoupon", "Id");
		generator.createDefaultTable("direct_mail_goods_order_channel", "DirectMailGoodsOrderChannel");
		// 支付 
		generator.createDefaultTable("payment_order", "PaymentOrder", "PaymentOrderId");
		generator.createDefaultTable("payment_order_record", "PaymentOrderRecord", "Id");
		//商户信息
		generator.createDefaultTable("store", "Store", "StoreId");
		//用户关联外部信息
		generator.createDefaultTable("user_external_info", "UserExternalInfo");
		//优惠券
		generator.createDefaultTable("coupon", "Coupon", "CouponId");
		generator.createDefaultTable("coupon_class", "CouponClass", "CouponClassId");
		generator.createDefaultTable("coupon_class_expire_strategy", "CouponClassExpireStrategy");
		generator.createDefaultTable("coupon_verifying_consumption", "CouponVerifyingConsumption", "Id");
		//税率管理
		generator.createDefaultTable("tax_rate", "TaxRate", "TaxRateId");
		//直邮产品销售数据统计表
		generator.createDefaultTable("direct_mail_goods_product_total_data", "DirectMailGoodsProductTotalData", "Id");
		generator.createDefaultTable("direct_mail_goods_product_increment_data", "DirectMailGoodsProductIncrementData", "Id");
		//直邮订单数据统计表
		generator.createDefaultTable("direct_mail_goods_order_total_data", "DirectMailGoodsOrderTotalData", "Id");
		generator.createDefaultTable("direct_mail_goods_order_increment_data", "DirectMailGoodsOrderIncrementData", "Id");
		//用户订单数据统计表
		generator.createDefaultTable("user_order_data", "UserOrderData", "Id");
		generator.generate();
	}
}
